﻿using System;
using System.Linq;

namespace CFConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var db = new MCPEntities())
            {
                if (db.Users.FirstOrDefault(u => u.Username == "user") == null)
                {
                    db.Users.Add(new User()
                        {
                            ID = Guid.NewGuid(),
                            Username = "user",
                            Password = "user",
                            Settings = new Settings() { Email = "user@example.com" }
                        });
                    db.Users.Add(new User()
                        {
                            ID = Guid.NewGuid(),
                            Username = "admin",
                            Password = "admin",
                            Settings = new Settings() { Email = "admin@example.com" }
                        });

                    db.SaveChanges();
                }

                Console.WriteLine("Existed users are:");
                foreach (var user in db.Users)
                {
                    Console.WriteLine(string.Format("Login: {0}\r\nPassword: {1}\r\nID: {2}", user.Username,
                                                    user.Password, user.ID));
                    Console.WriteLine("====================");
                }

                Console.ReadLine();
            }
        }
    }
}
